﻿/*
	Class			Load
	Package			utilities.Load
	
	Description		Experimental class for making using the Loader class easier.
					Can pass URL string into contstructor.
					Can also pass the functions for monitoring progress into the constructor.
					
	History			1.00	6/06/07		Created
	
	To Do			Rethink how to handle the progress monitoring, in a way that is more similar to AS3.0 Standards.
*/

package utilities
{
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.ProgressEvent;
	import flash.net.URLRequest;
	
	public class Load extends Loader
	{
		public dynamic function Load (url:String, whenLoaded:Function = null, duringProgress:Function = null)
		{
			super ();
			var urlRequest:URLRequest = new URLRequest (url);
			load (urlRequest);
			
			if (whenLoaded != null)
			{
				contentLoaderInfo.addEventListener(Event.COMPLETE, whenLoaded);
			}
			
			if (duringProgress != null)
			{
				contentLoaderInfo.addEventListener (ProgressEvent.PROGRESS, duringProgress);
			}

		}
		
		
	}
}